/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ChArFaTo
 */
@Entity
@Table(name = "matriculaacademica", catalog = "proyectosw", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MatriculaacademicaEJB.findAll", query = "SELECT m FROM MatriculaacademicaEJB m"),
    @NamedQuery(name = "MatriculaacademicaEJB.findByMAcodigo", query = "SELECT m FROM MatriculaacademicaEJB m WHERE m.mAcodigo = :mAcodigo"),
    @NamedQuery(name = "MatriculaacademicaEJB.findByMAfecha", query = "SELECT m FROM MatriculaacademicaEJB m WHERE m.mAfecha = :mAfecha"),
    @NamedQuery(name = "MatriculaacademicaEJB.findByMAcreditosHabilitados", query = "SELECT m FROM MatriculaacademicaEJB m WHERE m.mAcreditosHabilitados = :mAcreditosHabilitados"),
    @NamedQuery(name = "MatriculaacademicaEJB.findByMAcreditosusados", query = "SELECT m FROM MatriculaacademicaEJB m WHERE m.mAcreditosusados = :mAcreditosusados"),
    @NamedQuery(name = "MatriculaacademicaEJB.findByMAmatriculado", query = "SELECT m FROM MatriculaacademicaEJB m WHERE m.mAmatriculado = :mAmatriculado")})
public class MatriculaacademicaEJB implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer mAcodigo;
    @Size(max = 255)
    @Column(length = 255)
    private String mAfecha;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private int mAcreditosHabilitados;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private int mAcreditosusados;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private boolean mAmatriculado;
    @JoinTable(name = "matriculaacademica_grupo", joinColumns = {
        @JoinColumn(name = "MatriculaAcademicaMAcodigo", referencedColumnName = "MAcodigo", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "GrupoGCodigo", referencedColumnName = "GCodigo", nullable = false)})
    @ManyToMany
    private Collection<GrupoEJB> grupoEJBCollection;
    @JoinColumn(name = "Jefe de ProgramaJCodigo", referencedColumnName = "JCodigo")
    @ManyToOne
    private JefeDeProgramaEJB jefedeProgramaJCodigo;

    public MatriculaacademicaEJB() {
    }

    public MatriculaacademicaEJB(Integer mAcodigo) {
        this.mAcodigo = mAcodigo;
    }

    public MatriculaacademicaEJB(Integer mAcodigo, int mAcreditosHabilitados, int mAcreditosusados, boolean mAmatriculado) {
        this.mAcodigo = mAcodigo;
        this.mAcreditosHabilitados = mAcreditosHabilitados;
        this.mAcreditosusados = mAcreditosusados;
        this.mAmatriculado = mAmatriculado;
    }

    public Integer getMAcodigo() {
        return mAcodigo;
    }

    public void setMAcodigo(Integer mAcodigo) {
        this.mAcodigo = mAcodigo;
    }

    public String getMAfecha() {
        return mAfecha;
    }

    public void setMAfecha(String mAfecha) {
        this.mAfecha = mAfecha;
    }

    public int getMAcreditosHabilitados() {
        return mAcreditosHabilitados;
    }

    public void setMAcreditosHabilitados(int mAcreditosHabilitados) {
        this.mAcreditosHabilitados = mAcreditosHabilitados;
    }

    public int getMAcreditosusados() {
        return mAcreditosusados;
    }

    public void setMAcreditosusados(int mAcreditosusados) {
        this.mAcreditosusados = mAcreditosusados;
    }

    public boolean getMAmatriculado() {
        return mAmatriculado;
    }

    public void setMAmatriculado(boolean mAmatriculado) {
        this.mAmatriculado = mAmatriculado;
    }

    @XmlTransient
    public Collection<GrupoEJB> getGrupoEJBCollection() {
        return grupoEJBCollection;
    }

    public void setGrupoEJBCollection(Collection<GrupoEJB> grupoEJBCollection) {
        this.grupoEJBCollection = grupoEJBCollection;
    }

    public JefeDeProgramaEJB getJefedeProgramaJCodigo() {
        return jefedeProgramaJCodigo;
    }

    public void setJefedeProgramaJCodigo(JefeDeProgramaEJB jefedeProgramaJCodigo) {
        this.jefedeProgramaJCodigo = jefedeProgramaJCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (mAcodigo != null ? mAcodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MatriculaacademicaEJB)) {
            return false;
        }
        MatriculaacademicaEJB other = (MatriculaacademicaEJB) object;
        if ((this.mAcodigo == null && other.mAcodigo != null) || (this.mAcodigo != null && !this.mAcodigo.equals(other.mAcodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Modelo.MatriculaacademicaEJB[ mAcodigo=" + mAcodigo + " ]";
    }
    
}
